<?	/* @var $form SettingForm */	?>
<? use_helper("jQuery"); ?>
<?
if ($form instanceOf TemplateSettingForm){
	$updateRouteName="@template_settings_update";
}else{
	$updateRouteName="@settings_update";
}
?>
<form action="<?= url_for($updateRouteName, $form->getObject()) ?>" method="POST" enctype="multipart/form-data">
	<?//=	$form["_csrf_token"]->render() ?>
	<?=	$form->renderGlobalErrors() ?>


	<?// if (!$form->getObject()->isNew()):// REST! ?>
		<input type="hidden" name="sf_method" value="PUT" />
		<? //=	$form["id"]->render() ?>
	<?// endif ?>

	<?	$group="" ?>
	<?	foreach ($form as $field): ?>
		<?	/* @var $field sfFormField */ ?>
		<?	if (!$field->isHidden()): 	?>
			<?	$cGroup=$form->getFieldsGroup($field) ?>
				<?	if ($group!=$cGroup):	?>
					<h3><?= sfInflector::humanize(sfInflector::underscore($cGroup)) ?></h3>
				<?	endif ?>
			<?	$group=$cGroup	?>

			<?=	$field->renderLabel()	?>:

		<?	endif ?>

		<?	$description=$field->getWidget()->getAttribute("description") ?>
		<?
			//	unsetojam description pirms renderēšanas, jo taada HTML atribūta nav
			$field->getWidget()->setAttribute("description", null)
		?>

		<?=	$field->renderError() ?>
		<?=	$field->render()	?>
		<?= $description ?>

		<?	if (!$field->isHidden()): ?>
			<br/>
		<?	endif ?>
	<?	endforeach ?>

	<input type="submit" value="Ok" />
	<?= jq_submit_to_remote("name", "AJAX save", array("url" => url_for($updateRouteName, $form->getObject()).".json")) ?>
</form>
